
# 单继承示例

class Human:
    '''此类定义人类共有的行为'''
    def say(self, content):
        print('说', content)
    def walk(self, distance):
        print('走了', distance, '公里')

class Student(Human):
    def study(self, subject):
        print('学习', subject)

class Teacher(Student):
    def teach(self, subject):
        print('教', subject)

H1 = Human()
H1.say('今天阴天')
H1.walk(1)

s1 = Student()
s1.say('明天会更好')
s1.walk(4)
s1.study('面向对象')

t1 = Teacher()
t1.walk(8)
t1.say('有点累')
t1.teach('C++')
t1.study('钢琴')
print(Teacher.__base__.__base__.__base__)